/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.shuju.jiegou.test;

/**
* 虚拟机参数：-verbose:gc
*/
public class ReferenceCountingGC
{
   private Object instance = null;
   private static final int _1MB = 1024 * 1024;
   
   /** 这个成员属性唯一的作用就是占用一点内存 */
   private byte[] bigSize = new byte[2 * _1MB];
   
   public static void main(String[] args)
   {
       ReferenceCountingGC objectA = new ReferenceCountingGC();
       ReferenceCountingGC objectB = new ReferenceCountingGC();
       objectA.instance = objectB;
       objectB.instance = objectA;
       objectA = null;
       objectB = null;
       
       System.gc();
   }
}
